import example as e
#print e.cvar.the_answer
s = 'hello world'
e.print_str(s, len(s))
e.capital_str(s)
print "Capitalized: ", s

b = e.uchar_array(16)
for i in range(16):
    b[i] = i
e.revert_uchar_array(b, 16)
for i in range(16):
    print "%02X " % b[i]

# uchar_array -> str
#str_inst = e.cdata(b, 16)
siz = 11
pint_array_inst_a = e.int_array(siz)
for i in range(siz):
    pint_array_inst_a[i] = i
str_inst = e.cdata(pint_array_inst_a, siz * 4)
print "type of str_inst ", type(str_inst), " siz: ", siz, " len: ", len(str_inst)

pint_array_inst = e.int_array(siz)
puchar_array_inst = e.uchar_array_frompointer(e.pint_to_puchar(pint_array_inst))
#puchar_array_inst = e.uchar_array(siz * 4)
for i in range(siz * 4):
    puchar_array_inst[i] = i
puchar = e.puchar()

#e.memmove(pint_array_inst, e.puchar_to_pvoid_const(puchar_array_inst.cast()))
e.revert_uchar_array(e.pint_to_puchar(pint_array_inst),siz*4)
e.revert_uchar_array(e.puchar_frompointer(e.pint_to_puchar(pint_array_inst)),siz*4)
for i in range(siz):
    print "%8X " % pint_array_inst[i]

# pint_array -> str

str_inst = '\x01' * 16
